package com.iuie.ns.datum.vo;

import java.io.Serializable;

import com.iuie.ns.devtools.to.DevBodyTO;
import com.iuie.ns.frame.utils.StringUtils;

/**
 * 开发工具箱-表的字段
 * @author iuie
 * @date 2018-01-25 15:26:01
 */
public class TableFieldVO extends DevBodyTO implements Serializable {

	private static final long serialVersionUID = -2718265951007180964L;
	
	private Long id; // ID
	private Long tableId; // 用户表ID
	private String fieldName; // 字段名称
	private String fieldType; // 字段类型
	private String allowNull; // 是否非空
	private String isPrimaryKey; // 主键标识
	private Integer fieldLength; // 字段长度
	private String comment; // 字段备注
	private Integer weight; // 权重，顺序
	
	private String doQuery; // 是否用于查询
	private String queryMode; // 模糊/精确查询
	private String display; // 前端显示
	private String doUpdate; // 是否用于更新
	
	public TableFieldVO() {
		
	}
	
	public TableFieldVO(Long id, Long tableId, String fieldName, String fieldType, String allowNull, String isPrimaryKey, Integer fieldLength, String comment) {
		super();
		this.id = id;
		this.tableId = tableId;
		this.fieldName = fieldName;
		this.fieldType = fieldType;
		this.allowNull = allowNull;
		this.isPrimaryKey = isPrimaryKey;
		this.fieldLength = fieldLength;
		this.comment = comment;
	}

	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public Long getTableId() {
		return tableId;
	}
	public void setTableId(Long tableId) {
		this.tableId = tableId;
	}
	public String getFieldName() {
		return fieldName;
	}
	public void setFieldName(String fieldName) {
		this.fieldName = fieldName;
	}
	public String getFieldType() {
		return fieldType;
	}
	public void setFieldType(String fieldType) {
		this.fieldType = fieldType;
	}
	public String getAllowNull() {
		return allowNull;
	}
	public void setAllowNull(String allowNull) {
		this.allowNull = allowNull;
	}
	public String getIsPrimaryKey() {
		return isPrimaryKey;
	}
	public void setIsPrimaryKey(String isPrimaryKey) {
		this.isPrimaryKey = isPrimaryKey;
	}
	public Integer getFieldLength() {
		return fieldLength;
	}
	public void setFieldLength(Integer fieldLength) {
		this.fieldLength = fieldLength;
	}
	public String getComment() {
		return comment;
	}
	public void setComment(String comment) {
		this.comment = comment;
	}
	public Integer getWeight() {
		return weight;
	}
	public void setWeight(Integer weight) {
		this.weight = weight;
	}
	public String getDoQuery() {
		return doQuery;
	}
	public void setDoQuery(String doQuery) {
		this.doQuery = doQuery;
	}
	public String getQueryMode() {
		return queryMode;
	}
	public void setQueryMode(String queryMode) {
		this.queryMode = queryMode;
	}
	public String getDisplay() {
		return display;
	}
	public void setDisplay(String display) {
		this.display = display;
	}
	public String getDoUpdate() {
		return this.doUpdate;
	}
	public void setDoUpdate(String doUpdate) {
		this.doUpdate = doUpdate;
	}
	@Override
	public Boolean isIdAttribute() {
		return StringUtils.equals(this.isPrimaryKey, "1");
	}

	@Override
	public Boolean isDoQueryAttribute() {
		return StringUtils.equals(this.doQuery, "1");
	}

	@Override
	public Boolean isDoUpdateAttribute() {
		return StringUtils.equals(this.doUpdate, "1");
	}

	@Override
	public Boolean allowNull() {
		return StringUtils.equals(this.allowNull, "1");
	}
}
